<?php
/**
 * 系统设置
 *
 * @copyright   Copyright 2011, Richie
 * @author      Richie <richbossman@163.com>
 * @package     SMS
 * @link        http://www.letphp.com
 * 
 * $Id: SetAction.class.php 53 2011-03-25 14:02:39Z 442767452@qq.com $
 */
class SetAction extends SystemAction {
	
	function _before_index(){
		if(isset($_POST['sets']) && !empty($_POST['sets'])){
			D('Set')->updateSet($_POST['sets']);
			$this->success('设置保存成功！');
		}
		$this->assign('group', D('Set')->getSetList());
	}
	
	function _before_add(){
		$this->assign('type', $this->setTypes());
		$this->assign('group', D('Set')->getGroup());
	}
	
	function _button_set_index(){
		return array('add');
	}
	
	function _button_set_add(){
		return array(array('icon'=>'list', 'action'=>'index'));
	}
	
	/**
	 * 设置类型
	 *
	 * @return array
	 */
	private function setTypes(){
		return array(
			'text'	=> '文本框',
			'textarea' => '文本区域',
			'select' => '下拉框',
			'password' => '密码框',
			'manual' => '系统数据',
			'hidden' => '系统常量',
			'group' => '配置组'
		);
	}
}
?>